# coding=utf-8
"""
记录日志
"""
import uuid

from mynest.dao.logdao import LogDao


class LogSV:
    def __init__(self):
        self.logdao = LogDao()

    def listLogs(self):
        """
        查询日志分组集合
        :return:
        """
        return self.logdao.queryLogs()

    def listLogsByJob(self, job):
        """
        根据job查询job的日志结合信息
        :param job: Auth,Lock,DoorLight,BedLight,RoomLight
        :return: jobs
        """
        return self.logdao.queryLogsByJob(job)

    def addLog(self, logpojo):
        """
        增加日志
        :param logpojo:
        :return:
        """
        logpojo.code = uuid.uuid1()
        self.logdao.insert(logpojo)
